import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart';

class Core{
  Core._();
  static late final String version;
  static late final PackageInfo pkg;
  static late final Directory cache;
  static late final Directory support;
  static late final Directory document;

  static Future<void> initialize()async{
    pkg = await PackageInfo.fromPlatform();
    version = pkg.version;
    cache = await getTemporaryDirectory();
    support = await getApplicationSupportDirectory();
    document = await getApplicationDocumentsDirectory();
  }

  static bool get isDesktop {
    if (kIsWeb) return false;
    return [
      TargetPlatform.windows,
      TargetPlatform.linux,
      TargetPlatform.macOS,
    ].contains(defaultTargetPlatform);
  }
}